<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
	
<script type="text/javascript">
	$(document).ready(function(){
		$('#new-key-btn').click(function() {
			$('#new-key-div').toggle('slow');
		});
		
		$('#login-link').click(function() {
			$('#login-div').toggle('slow');
		});
		
		$('#error-div').show('slide', {direction: 'right'}, 1500);
		
		$(function() {
			$( "#dateTaken" ).datepicker({
				showOn: "button",
				buttonImage: "resources/calendar.gif",
				buttonImageOnly: true,
				dateFormat: "dd/mm/yy",
			});
		});
		
		$('#checkButton').click(function(){
			var username = $('#username').val();
			if(username == '') {
				alert('Please provide username to check');
				return;
			}
			$.post('<c:url value="/register/check"/>', { username : username }, function(data) {
				$('#result').html(data);
			});
		});
	});
</script>

<div class="box">
	<form:form modelAttribute="registerForm" method="POST">
		${username}
		<table>
			<tr><td>First Name</td><td><form:input path="firstName"/></td></tr>
			<tr><td>Last Name</td><td><form:input path="lastName"/></td></tr>
			<tr><td>Email </td><td><form:input path="email"/></td></tr>
			<tr><td>Password</td><td><form:input path="password" /></td></tr>
			<tr><td>Role</td><td><form:input path="role" /></td></tr>
			<tr><td><input type="submit" value="Update" class="button"></td></tr>
		</table>
	</form:form>
</div>		